﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit_bug.aspx.cs" Inherits="btnet.pages.edit_bug" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title id="titl" runat="server">add new</title>
<link rel="StyleSheet" href="~/scripts/css/btnet.css" type="text/css" />
<link rel="StyleSheet" href="~/scripts/jquery/ui.datepicker.css" type="text/css" />
<!-- use btnet_edit_bug.css to control positioning on edit_bug.asp.  use btnet_search.css to control position on search.aspx  -->
<link rel="StyleSheet" href="~/custom/btnet_edit_bug.css" type="text/css" />
<script type="text/javascript" language="JavaScript" src="../scripts/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="JavaScript" src="../scripts/jquery/jquery-ui-1.6rc2.min.js"></script>
<script type="text/javascript" language="JavaScript" src="../scripts/jquery/jquery.textarearesizer.compressed.js"></script>
<script type="text/javascript" language="JavaScript" src="../scripts/javascripts/edit_bug.js"></script>
<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>

<script type="text/javascript" language="javascript">
var this_bugid = <% Response.Write(Convert.ToString(id)); %>

$(document).ready(do_doc_ready);

function do_doc_ready()
{
	date_format = '<% getDateFormat(); %>'
	$(".date").datepicker({dateFormat: date_format, duration: 'fast'})
	$(".date").change(mark_dirty)
	$(".warn").click(warn_if_dirty) 
	$("textarea.resizable:not(.processed)").TextAreaResizer()
	
	<% 
	
	if (security.user.use_fckeditor)	
	{
		Response.Write ("CKEDITOR.replace( 'comment' )");
	}
	else
	{
		Response.Write("$('textarea.resizable2:not(.processed)').TextAreaResizer()");
	}	
	
	%>	
}

function start_animation()
{

<% if (EnableNewPostAnimation.Equals("1")) { %>

	color = 100
	
	if (navigator.userAgent.indexOf("MSIE") > 0)
		new_posts = getElementsByName_for_ie6_and_ie7("td","new_post") 
	else
		new_posts = document.getElementsByName("new_post") 
	
	
	new_posts_length = new_posts.length

	if (new_posts_length > 0)
	{
		
		timer = setInterval(timer_callback,5)
	}

<% } %>	
}

function disable_second_button()
{
<% if (DisplayAnotherButtonInEditBugPage.Equals("1")) { %>
	el = get_el("sub");
	el.disabled = true;
<% } %>	

}

</script>

</head>

<body onload='on_body_load()' onunload='on_body_unload()'>
<% security.write_menu(Response, PluralBugLabel); %>

<div class=align>

<% if (!security.user.adds_not_allowed) { %>
<a class=warn href="edit_bug.aspx?id=0">
    <img src="../images/add.png" border=0 align=top>&nbsp;add new <% Response.Write(SingularBugLabel); %></a>
&nbsp;&nbsp;&nbsp;&nbsp;
<% } %>
<span id="prev_next" runat="server">&nbsp;</span>


<br><br>

<table border=0 cellspacing=0 cellpadding=3>
<tr>

<td nowrap valign=top> <!-- links -->
	<div id="edit_bug_menu">
		<ul>
			<li id="clone" runat="server"/>
			<li id="print" runat="server" />
			<li id="merge_bug" runat="server" />
			<li id="delete_bug" runat="server" />
			<li id="svn_revisions" runat="server" />
			<li id="git_commits" runat="server" />
			<li id="hg_revisions" runat="server" />
			<li id="subscribers" runat="server" />
			<li id="subscriptions" runat="server" />
			<li id="relationships" runat="server" />
			<li id="tasks" runat="server" />
			<li id="send_email" runat="server" />
			<li id="attachment" runat="server" />
			<li id="custom" runat="server" />
		</ul>
	</div>

<td nowrap valign=top> <!-- form -->

<div id="bugform_div">
<form id="Form1" class=frm runat="server">

	<% if (DisplayAnotherButtonInEditBugPage.Equals("1")) { %>
		<div>
				<span runat="server" class=err id="custom_field_msg2">&nbsp;</span>
				<span runat="server" class=err id="msg2">&nbsp;</span>
		</div>
		<div style="text-align: center;">
			<input
				runat="server"
				class=btn
				type=submit
				id="sub2"
				onclick="disable_me()"
				value="Update"
				OnServerClick="on_update">
		</div>			
	<% } %>			
	<table border=0 cellpadding=3 cellspacing=0>
	<tr>
		<td nowrap valign=top>
			<span class=lbl id="bugid_label" runat="server"></span>
			<span runat="server" class="bugid" id="bugid"></span>&nbsp;

		<td valign=top>			

			<span class="short_desc_static" id="static_short_desc" runat="server" style='width:500px; display:none;'></span>


			<input title="" runat="server" type=text class="short_desc_input" id="short_desc" maxlength="200"  
				onkeydown="count_chars('short_desc',200)" onkeyup="count_chars('short_desc',200)">
				&nbsp;&nbsp;&nbsp;
				<span runat="server" class=err id="short_desc_err"></span>
				
			<div class=smallnote id="short_desc_cnt">&nbsp;</div>

	</table>			
	<table width=90% border=0 cellpadding=3 cellspacing=0>
	<tr>
		<td nowrap>
			<span runat="server" id=reported_by></span>

		<% if (id == 0 || CheckSecurityAll() == true) { %>
		<td nowrap align=right id="presets" >Presets:
			<a title="Use previously saved settings for project, category, priority, etc..."
				href="javascript:get_presets()">use</a>
			&nbsp;/&nbsp;
			<a title="Save current settings for project, category, priority, etc., so that you can reuse later."
				href="javascript:set_presets()">save</a>
		<% } %>

	</table>

	<table border=0 cellpadding=0 cellspacing=4>

	<tr id="tags_row">
		<td nowrap>
			<span class=lbl id="tags_label" runat="server">Tags:&nbsp;</span>
		
		<td nowrap>
			<span class="stat" id="static_tags" runat="server"></span>
			<input runat="server" type=text class=txt id="tags" size="70" maxlength="80"  onkeydown="mark_dirty()" onkeyup="mark_dirty()">
			<span id="tags_link" runat="server">&nbsp;&nbsp;<a href='javascript:show_tags()'>tags</a></span>


	<tr id="row1">
		<td nowrap>
			<span class=lbl id="project_label" runat="server">Project:&nbsp;</span>
		<td nowrap>
			<span class="stat" id="static_project" runat="server"></span>

			<asp:DropDownList id="project" runat="server"
			AutoPostBack="True"></asp:DropDownList>

		<!--
		<td rowspan=100 bgcolor=yellow width=40>&nbsp;
		<td rowspan=100 bgcolor=pink width=200>I'll put something here eventually...
		-->
	<tr id="row2">
		<td nowrap>
			<span class=lbl id="org_label" runat="server">Organization:&nbsp;</span>
		<td nowrap>
			<span class="stat" id="static_org" runat="server"></span>
			<asp:DropDownList id="org" runat="server"></asp:DropDownList>

	<tr id="row3">
		<td nowrap>
			<span class=lbl id="category_label" runat="server">Category:&nbsp;</span>
		<td nowrap>
			<span class="stat" id="static_category" runat="server"></span>
			<asp:DropDownList id="category" runat="server"></asp:DropDownList>

	<tr id="row4">
		<td nowrap>
			<span class=lbl id="priority_label" runat="server">Priority:&nbsp;</span>
		<td nowrap>
			<span class="stat" id="static_priority" runat="server"></span>
			<asp:DropDownList id="priority" runat="server"></asp:DropDownList>

	<tr id="row5">
		<td nowrap>
			<span class=lbl id="assigned_to_label" runat="server">Assigned to:&nbsp;</span>
		<td nowrap>
			<span class="stat" id="static_assigned_to" runat="server"></span>
			<asp:DropDownList id="assigned_to" runat="server"></asp:DropDownList>
			&nbsp;
			<span runat="server" class="err" id="assigned_to_err"></span>

	<tr id="row6">
		<td nowrap>
			<span class=lbl id="status_label" runat="server">Status:&nbsp;</span>
		<td nowrap>
			<span class="stat" id="static_status" runat="server"></span>
			<asp:DropDownList id="status" runat="server"></asp:DropDownList>

<%
    if (ShowUserDefinedBugAttribute.Equals("1"))
{
%>
	<tr id="row7">
		<td nowrap>
			<span class=lbl id="udf_label" runat="server">
			<% Response.Write(UserDefinedBugAttributeName); %>:&nbsp;</span>
		<td nowrap>
			<span class="stat" id="static_udf" runat="server"></span>
			<asp:DropDownList id="udf" runat="server">
			</asp:DropDownList>
<%
}
    //Create custom column INPUT Elements
    CreateInputElements();    
    
%>

	</table>


	<table border=0 cellpadding=0 cellspacing=3 width=98%>

	<tr><td nowrap>

		&nbsp;
		<span id="comment_label" runat="server">Comment:</span>
		
		<span class="smallnote" style="margin-left: 170px">
		<% 		
            DisplaySecurityLink();
		%>		
		</span>
		<br>
		<textarea  id="comment" rows=5 cols=100 runat="server" class="txt resizable2" onkeydown="mark_dirty()" onkeyup="mark_dirty()"></textarea>

	<tr><td  nowrap>
		<asp:checkbox runat="server" class=cb id="internal_only"/>
		<span runat="server" id="internal_only_label">Comment visible to internal users only</span>


	<tr><td nowrap align=left>
		<span runat="server" class=err id="custom_field_msg">&nbsp;</span>
		<span runat="server" class=err id="custom_validation_err_msg">&nbsp;</span>
		<span runat="server" class=err id="msg">&nbsp;</span>


	<tr><td nowrap align=center>
		<input
			runat="server"
			class=btn
			type=submit
			id="sub"
			onclick="disable_me()"
			value="Update"
			OnServerClick="on_update">

	</table>

	<input type=hidden id="new_id" runat="server" value="0">
	<input type=hidden id="prev_short_desc" runat="server">
	<input type=hidden id="prev_tags" runat="server">
	<input type=hidden id="prev_project" runat="server">
	<input type=hidden id="prev_project_name" runat="server">
	<input type=hidden id="prev_org" runat="server">
	<input type=hidden id="prev_org_name" runat="server">
	<input type=hidden id="prev_category" runat="server">
	<input type=hidden id="prev_priority" runat="server">
	<input type=hidden id="prev_assigned_to" runat="server">
	<input type=hidden id="prev_assigned_to_username" runat="server">
	<input type=hidden id="prev_status" runat="server">
	<input type=hidden id="prev_udf" runat="server">
	<input type=hidden id="prev_pcd1" runat="server">
	<input type=hidden id="prev_pcd2" runat="server">
	<input type=hidden id="prev_pcd3" runat="server">
	<input type=hidden id="snapshot_timestamp" runat="server">
	<input type=hidden id="clone_ignore_bugid" runat="server" value="0">

<%

	// create the "Prev" fields for the custom columns so that we
	// can create an audit trail of their changes.

	foreach (string column_name in hash_custom_cols.Keys)
	{
		Response.Write ("<input type=hidden name=\"prev_");
		Response.Write(column_name);
		Response.Write ("\"");

		// output a date field according to the specified format
		Response.Write (" value=\"");
		//modified by CJU on jan 9 2008
		Response.Write(hash_custom_cols[column_name]);
		//modified by CJU on jan 9 2008
		Response.Write ("\">\n");
	}

%>


</form>
</div> <!-- bug form div -->
</table>

<br>
<span id="toggle_images" runat="server"></span>
&nbsp;&nbsp;&nbsp;&nbsp;
<span id="toggle_history" runat="server"></span>
<br><br>

<div id="posts">

	<%
	 //Print Bug Comments  
        PrintBugComments();    
	%>


</div>

</div>
<% Response.Write(Application["custom_footer"]); %>
</html>
